<!doctype html>
<html>
<head>
    <title>攻略</title>
    <?php $this->load->module('admin/index/page_header');?>
    <script type="text/javascript">
        window.UEDITOR_HOME_URL = "<?php echo URLPRE.'static/public/Lib/ueditor/';?>";
    </script>
    <script type="text/javascript" src="<?php echo URLPRE;?>static/public/Lib/ueditor/ueditor.config.js" charset="utf-8"></script>
    <script type="text/javascript" src="<?php echo URLPRE;?>static/public/Lib/ueditor/ueditor.all.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="<?php echo URLPRE;?>static/public/Lib/ueditor/lang/zh-cn/zh-cn.js" charset="utf-8"></script>
    <script type="text/javascript" src="<?php echo URLPRE;?>static/public/Lib/webuploader/webuploader.js"></script>
    <link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/public/Lib/webuploader/webuploader.css">

</head>
<body>
<script>
    var URLPRE = '<?php echo URLPRE ;?>';
    var URLPRC = '<?php echo URLPIC;?>'
    window.UEDITOR_HOME_URL = "<?php echo URLPRE . 'static/public/Lib/ueditor/';?>";
    var UEDITOR_SERVER_URL = '<?php echo site_url('ueditor/core/geteway');?>';

    var Ueditor_TEXT_CONFIG = {
        toolbars: [['bold', 'underline', 'strikethrough', 'insertorderedlist', 'insertunorderedlist', 'link', 'unlink', 'source', 'simpleupload']],
        initialFrameHeight: 420,
        initialFrameWidth: 800,

        iframeCssUrl: URLPRE + 'static/public/Lib/ueditor/css/ueditor.css'
    };

    //文本编辑器
    UE.getEditor('text-editor', Ueditor_TEXT_CONFIG);
</script>
<div class="wrap J_check_wrap">
    <div class="nav">
        <ul class="cc">
            <li><a href="<?php echo site_url('trips/admin/index');?>">返回上一级</a></li>
            <li class="current"><a href="">修改攻略</a></li>
        </ul>
    </div>
    <div class="h_a">修改攻略</div>
    <form class="formvalidate" action="" method="post">
    <div class="table_full">
        <table width="100%">
            <colgroup><col class="th"></colgroup>
            <tr>
                <th>标题</th>
                <td><input name="t[subject]" class="input" type="text" size="80" validate="{required:true}" value="<?php echo $data['subject']?>"></td>
            </tr>
            <tr style="display: none">
                <th>归属地</th>
                <td>
                    <div class="mb10">
                        <script type="text/javascript">
                            var distary = ['continent', 'country', 'province', 'city', 'area'];
                        </script>
                        <select name="t[continent][]" id="continent" onChange="_showdistrict(distary, 1)">
                            <option value="-1" did="-1">选择洲</option>
                        </select>
                        <select name="t[country][]" id="country" onChange="_showdistrict(distary, 2)">
                            <option value="-1" did="-1">选择国家</option>
                        </select>
                        <select name="t[province][]" id="province" onChange="_showdistrict(distary, 3)">
                            <option value="-1" did="-1">选择省</option>
                        </select>
                        <select name="t[city][]" id="city" onChange="_showdistrict(distary, 4)">
                            <option value="-1" did="-1">选择市</option>
                        </select>
                        <select name="t[area][]" id="area">
                            <option value="-1" did="-1">选择区/县</option>
                        </select>
                    </div>  
                    <a class="add" href="javascript:void(0);" id="add-dist" onClick="add_dist(this);">增加归属地</a>
                    <a href="javascript:void(0);" id="remove-dist" onClick="del_dist(this);">移除归属地</a>
                    <font color="red">&nbsp;&nbsp;&nbsp;&nbsp;<?php if(isset($data['o_dist'])&&$data['o_dist']){echo '参考：'.$data['o_dist'];}?></font>
                </td>
            </tr>
            <tr>
                <th>分类</th>
                <td>
                    <select name="t[category]">
                        <?php echo $category_list?>
                    </select>
                </td>
            </tr>
            <tr>
                <th>推荐图片</th>
                <td class="rowform">
                    <ul>
                        <li><input type="text" class="input" size="30" name="t[file_url]" value="<?php echo $data['file_url'] ?>" id="file_url" /></li>
                        <li><div id="filePicker">选择图片</div></li>
                        <li><div class="webuploader-pick view_pic" data-uri="<?php echo filter_img($data['file_url']) ?>" title="查看图片">查看图片</div></li>
                    </ul>
                </td>
            </tr>
            <tr style="display: none">
                <th>来源</th>
                <td><input name="t[from]" class="input" type="text"></td>
            </tr>
            <tr style="display: none">
                <th>作者</th>
                <td><input name="t[author]" class="input" type="text" value="<?php echo $this->session->userdata('admin_user_name');?>"></td>
            </tr>
            <tr style="display: none">
                <th>关键词[SEO]</th>
                <td><textarea name="t[keywords]" cols="50" rows="5"></textarea></td>
            </tr>
            <tr style="display: none">
                <th>页面描述[SEO]</th>
                <td><textarea name="t[description]" cols="50" rows="5"></textarea></td>
            </tr>
            <tr>
                <th>概要</th>
                <td><textarea name="t[abstract]" cols="50" style="width:800px;" rows="5"><?php echo $data['abstract']?></textarea></td>
            </tr>
            <tr>
                <th>正文</th>
                <td><script id="text-editor"  name="t[message]" type="text/plain"><?php echo $data['message']?></script></td>
            </tr>
        </table>
    </div>

    <div class="btn_wrap">
        <div class="btn_wrap_pd">
            <button class="btn btn_submit J_ajax_submit_btn" type="submit">提交</button>
        </div>
    </div>
    </form>
</div>
<script type="text/javascript">
    var district_url = '<?php echo site_url('admin/api/city_fetch/?id=')?>';
<?php if(empty($data['dist'])){ ?>
    _showdistrict(distary, 0);
<?php }else{
        foreach ($data['dist'] as $k => $dist)
        {
            if($k>0){
?>
sel = 1;
$('#add-dist').trigger('click');
sel = 0;
<?php
            }
?>
_showdistrict(['continent'+dist, 'country'+dist, 'province'+dist, 'city'+dist, 'area'+dist], 0, null, [<?php echo implode(',', array($dist['continent'],$dist['country'],$dist['province'],$dist['city'],$dist['area']));?>]);
<?php
        }
}
?>

    UE.getEditor('editor');

    //图片上传
    upload_image("<?php echo site_url('admin/upload/ajax_upload');?>",'filePicker','file_url');
</script>
</body>
</html>